import { ref } from 'vue';
import { defineStore } from 'pinia';
import { useDark, useFullscreen } from '@vueuse/core';

export const useThemeStore = defineStore(
  'themeStore',
  () => {
    const asideVisible = ref(true); // 管理侧边栏的显示状态
    const isDark = useDark(); // 暗黑模式状态
    const { isFullscreen, toggle: toggleFullscreen } = useFullscreen();

    const toggleAside = () => {
      asideVisible.value = !asideVisible.value; // 切换显示状态
    };

    const toggleDark = () => {
      isDark.value = !isDark.value; // 切换暗黑模式
    };

    return { asideVisible, toggleAside, isDark, toggleDark, isFullscreen, toggleFullscreen };
  },
  {
    persist: true, // 持久化存储
  },
);
